#!/bin/sh
#
# This is the script for generating files for a specific Dalton test job.
#
# For the .check file ksh or bash is preferred, otherwise use sh
# (and hope it is not the old Bourne shell, which will not work)
#
if [ -x /bin/ksh ]; then
   CHECK_SHELL='#!/bin/ksh'
elif [ -x /bin/bash ]; then
   CHECK_SHELL='#!/bin/bash'
else
   CHECK_SHELL='#!/bin/sh'
fi


#######################################################################
#  TEST DESCRIPTION
#######################################################################
cat > geoopt_cartsad.info <<'%EOF%'
   geoopt_cartsad
   --------------
   Molecule:         C2H6
   Wave Function:    SCF / STO-3G
   Test Purpose:     Second order saddle point optimization in
                     Cartesian coordinates
%EOF%

#######################################################################
#  MOLECULE INPUT
#######################################################################
cat > geoopt_cartsad.mol <<'%EOF%'
BASIS
STO-3G
Second order saddle point optimization in Cartesian coordinates

Atomtypes=2
Charge=6.0 Atoms=2
C     0.0000000000        0.0000000000        1.4597876282             *
C     0.0000000000        0.0000000000       -1.4597876282             *
Atoms=6 Charge=1.0
H     1.6808445513        0.9704360937        2.1445545504             *
H    -1.6808445513        0.9704360937        2.1445545504             *
H     0.0000000000       -1.9408721894        2.1445545504             *
H    -1.9608445513       -0.4204360937       -2.1445545504             *
H     1.2008445513       -1.4004360937       -2.1445545504             *
H     0.4600000000        1.8308721894       -2.1445545504             *
%EOF%

#######################################################################
#  DALTON INPUT
#######################################################################
cat > geoopt_cartsad.dal <<'%EOF%'
**DALTON INPUT
.OPTIMIZE
*OPTIMIZE
.CARTES
.NEWTON
.TRSTRG
.SADDLE
**WAVE FUNCTION
.HF
**END OF DALTON INPUT
%EOF%
#######################################################################



#######################################################################

#######################################################################
#  CHECK SCRIPT
#######################################################################
echo $CHECK_SHELL >geoopt_cartsad.check
cat >>geoopt_cartsad.check <<'%EOF%'
log=$1

if [ `uname` = Linux ]; then
   GREP="egrep -a"
else
   GREP="egrep"
fi

#
# March 2012: disabled some checkes  because initial geometry changed. Not worth it to update all tests. --hjaaj
#

# Geometry optimization
CRIT1=`$GREP "Saddle point optimization has been requested\." $log | wc -l`
CRIT2=`$GREP "2nd order Newton method will be used\." $log | wc -l`
CRIT3=`$GREP "Optimization will be performed in Cartesian coordinates\." $log | wc -l`
CRIT4=`$GREP "Image function method will be used to control step \(default\)\." $log | wc -l`
CRIT5=`$GREP "The eigenvector corresponding to the lowest non-zero eigenvalue is chosen" $log | wc -l`
CRIT6=`$GREP "as reaction mode \(default\)\." $log | wc -l`
TEST[1]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6`
CTRL[1]=6
ERROR[1]="GEOMETRY OPTIMIZATION NOT SET UP CORRECTLY"

# Geometry
CRIT1=`$GREP "Total number of coordinates\: * 24" $log | wc -l`
CRIT2=`$GREP "3 * z * 1\.4598223474" $log | wc -l`
CRIT3=`$GREP "4 * x * (0| )\.0201357029" $log | wc -l`
CRIT4=`$GREP "6 * z * \-1\.4596834723" $log | wc -l`
CRIT5=`$GREP "7 * x * 1\.6428197329" $log | wc -l`
CRIT6=`$GREP "8 * y * 1\.0258944623" $log | wc -l`
CRIT7=`$GREP "9 * z * 2\.1559360111" $log | wc -l`
CRIT8=`$GREP "10 * x * \-1\.7169234124" $log | wc -l`
CRIT9=`$GREP "11 * y * (0| )\.9139003605" $log | wc -l`
CRIT10=`$GREP "12 * z * 2\.1327640108" $log | wc -l`
CRIT11=`$GREP "13 * x * (0| )\.0599355947" $log | wc -l`
CRIT12=`$GREP "14 * y * \-1\.9397948248" $log | wc -l`
CRIT13=`$GREP "15 * z * 2\.1450189290" $log | wc -l`
CRIT14=`$GREP "16 * x * \-1\.9208446692" $log | wc -l`
CRIT15=`$GREP "17 * y * (\-0|\-)\.4855279159" $log | wc -l`
CRIT16=`$GREP "18 * z * \-2\.1578535369" $log | wc -l`
CRIT17=`$GREP "19 * x * 1\.2716620058" $log | wc -l`
CRIT18=`$GREP "20 * y * \-1\.3596527890" $log | wc -l`
CRIT19=`$GREP "21 * z * \-2\.1358349591" $log | wc -l`
CRIT20=`$GREP "22 * x * (0| )\.4235983754" $log | wc -l`
CRIT21=`$GREP "23 * y * 1\.8451807069" $log | wc -l`
CRIT22=`$GREP "24 * z * \-2\.1416840166" $log | wc -l`
TEST[2]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
		$CRIT7 \+ $CRIT8 \+ $CRIT9 \+ $CRIT10 \+ $CRIT11 \+ $CRIT12 \+ \
		$CRIT13 \+ $CRIT14 \+ $CRIT15 \+ $CRIT16 \+ $CRIT17 \+ $CRIT18 \+ \
		$CRIT19 \+ $CRIT20 \+ $CRIT21 \+ $CRIT22`
CTRL[2]=22

CRIT1=`$GREP "Nuclear repulsion energy \: * 42\.349123177598 Hartree" $log | wc -l`
TEST[2]=`expr	$CRIT1 `
CTRL[2]=1

ERROR[2]="GEOMETRY NOT READ CORRECTLY"

# Initial energy
CRIT1=`$GREP "Final * HF energy\: * \-78\.300809229[01]" $log | wc -l`
TEST[3]=`expr	$CRIT1`
CTRL[3]=1
ERROR[3]="INITIAL ENERGY NOT CORRECT"

# Initial gradient to 1.0D-6 (threshold for SCF convergence)
CRIT1=`$GREP "C * \-0*\.001190.*   0*\.000022.*   0*\.009427" $log | wc -l`
CRIT2=`$GREP "C *   0*\.07332[67].* \-0*\.003654.* \-0*\.02252[89]" $log | wc -l`
CRIT3=`$GREP "H *   0*\.003321.*   0*\.003265.* \-0*\.003524" $log | wc -l`
CRIT4=`$GREP "H * \-0*\.004839.*   0*\.00129[34].* \-0*\.003290" $log | wc -l`
CRIT5=`$GREP "H *   0*\.001040.* \-0*\.004722.* \-0*\.003214" $log | wc -l`
CRIT6=`$GREP "H * \-0*\.028201.* \-0*\.003724.* \-0*\.007790" $log | wc -l`
CRIT7=`$GREP "H * \-0*\.032210.*   0*\.024261.*   0*\.01976[34]" $log | wc -l`
CRIT8=`$GREP "H * \-0*\.01124[67].* \-0*\.016741.*   0*\.011157" $log | wc -l`
TEST[4]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
		$CRIT7 \+ $CRIT8`
CTRL[4]=8

CRIT1=`$GREP "Norm of gradient  * \:  * 0*\.09751" $log | wc -l`
TEST[4]=`expr	$CRIT1 `
CTRL[4]=1
ERROR[4]="INITIAL GRADIENT NOT CORRECT"


## Initial Hessian
#CRIT1=`$GREP "C * x *   0*\.8625" $log | wc -l`
#CRIT2=`$GREP "C * y * \-0*\.0009.*   0*\.8643" $log | wc -l`
#CRIT3=`$GREP "C * z *   0*\.0010.* \-0*\.0001.* 0*\.7014" $log | wc -l`
#CRIT4=`$GREP "C * x * \-0*\.1211.* \-0*\.0001.* 0*\.0026.* 0*\.8162" $log | wc -l`
#CRIT5=`$GREP "C * y *   0*\.0035.* \-0*\.1245.* \-0*\.0002.* \-0*\.0869.* 0*\.99219" $log | wc -l`
#CRIT6=`$GREP "C * z *   0*\.0005.* 0*\.0000.* \-0*\.3169.* \-0*\.0625.* 0*\.0054.* 0*\.7041" $log | wc -l`
#CRIT7=`$GREP "H * x * \-0*\.3228.* \-0*\.1490.* \-0*\.0992.* 0*\.0055.* 0*\.0031.* 0*\.0031" $log | wc -l`
#CRIT8=`$GREP "H * y * \-0*\.1501.* \-0*\.1771.* \-0*\.0633.* 0*\.0029.* 0*\.0023.* 0*\.0032" $log | wc -l`
#CRIT9=`$GREP "H * z * \-0*\.1002.* \-0*\.0630.* \-0*\.1152.* \-0*\.0394.* \-0*\.0216.* \-0*\.0147" $log | wc -l`
#CRIT10=`$GREP "H * x * \-0*\.3457.* 0*\.1399.* 0*\.1017.* 0*\.0056.* \-0*\.0030.* \-0*\.0046" $log | wc -l`
#CRIT11=`$GREP "H * y * 0*\.1387.* \-0*\.1577.* \-0*\.0526.* \-0*\.0030.* 0*\.0019.* 0*\.0010" $log | wc -l`
#CRIT12=`$GREP "H * z * 0*\.1014.* \-0*\.0532.* \-0*\.1122.* 0*\.0382.* \-0*\.0238.* \-0*\.0139" $log | wc -l`
#CRIT13=`$GREP "H * x * \-0*\.0839.* 0*\.0110.* \-0*\.0046.* 0*\.0003.* \-0*\.0005.* 0*\.0012" $log | wc -l`
#CRIT14=`$GREP "H * y * 0*\.0099.* \-0*\.4178.* 0*\.1162.* 0*\.0000.* 0*\.0073.* \-0*\.0045" $log | wc -l`
#CRIT15=`$GREP "H * z * \-0*\.0040.* 0*\.1164.* \-0*\.1141.* 0*\.0007.* 0*\.0453.* \-0*\.0140" $log | wc -l`
#CRIT16=`$GREP "H * x * 0*\.0061.* 0*\.0015.* 0*\.0040.* \-0*\.3389.* \-0*\.0614.* \-0*\.0846" $log | wc -l`
#CRIT17=`$GREP "H * y * 0*\.0015.* 0*\.0005.* \-0*\.0000.* \-0*\.0603.* \-0*\.1097.* \-0*\.0205" $log | wc -l`
#CRIT18=`$GREP "H * z * \-0*\.0421.* \-0*\.0138.* \-0*\.0140.* \-0*\.0874.* \-0*\.0220.* \-0*\.1128" $log | wc -l`
#CRIT19=`$GREP "H * x * 0*\.0043.* \-0*\.0041.* \-0*\.0030.* \-0*\.2752.* 0*\.2287.* 0*\.1131" $log | wc -l`
#CRIT20=`$GREP "H * y * \-0*\.0044.* 0*\.0046.* 0*\.0045.* 0*\.2303.* \-0*\.3142.* \-0*\.1220" $log | wc -l`
#CRIT21=`$GREP "H * z * 0*\.0339.* \-0*\.0309.* \-0*\.0144.* 0*\.1141.* \-0*\.1218.* \-0*\.1159" $log | wc -l`
#CRIT22=`$GREP "H * x * 0*\.0006.* 0*\.0017.* \-0*\.0026.* \-0*\.0923.* \-0*\.0835.* 0*\.0337" $log | wc -l`
#CRIT23=`$GREP "H * y * 0*\.0017.* 0*\.0077.* \-0*\.0044.* \-0*\.0827.* \-0*\.4552.* 0*\.1373" $log | wc -l`
#CRIT24=`$GREP "H * z * 0*\.0093.* 0*\.0447.* \-0*\.0142.* 0*\.0335.* 0*\.1387.* \-0*\.1156" $log | wc -l`
#CRIT25=`$GREP "H * x * 0*\.3275" $log | wc -l`
#CRIT26=`$GREP "H * y * 0*\.1607.* 0*\.1708" $log | wc -l`
#CRIT27=`$GREP "H * z * 0*\.1078.* 0*\.0664.* 0*\.1203" $log | wc -l`
#CRIT28=`$GREP "H * x * \-0*\.0185.* 0*\.0200.* 0*\.0139.* 0*\.3517" $log | wc -l`
#CRIT29=`$GREP "H * y * \-0*\.0225.* 0*\.0136.* 0*\.0103.* \-0*\.1495.* 0*\.1500" $log | wc -l`
#CRIT30=`$GREP "H * z * \-0*\.0149.* 0*\.0095.* 0*\.0062.* \-0*\.1076.* 0*\.0584.* 0*\.1174" $log | wc -l`
#CRIT31=`$GREP "H * x * 0*\.0065.* \-0*\.0345.* 0*\.0156.* 0*\.0047.* 0*\.0359.* \-0*\.0162" $log | wc -l`
#CRIT32=`$GREP "H * y * 0*\.0079.* \-0*\.0115.* 0*\.0081.* \-0*\.0068.* \-0*\.0094.* 0*\.0069" $log | wc -l`
#CRIT33=`$GREP "H * z * 0*\.0020.* \-0*\.0178.* 0*\.0064.* \-0*\.0007.* \-0*\.0173.* 0*\.0061" $log | wc -l`
#CRIT34=`$GREP "H * x * 0*\.0009.* 0*\.0001.* 0*\.0017.* 0*\.0014.* 0*\.0002.* 0*\.0005" $log | wc -l`
#CRIT35=`$GREP "H * y * \-0*\.0001.* 0*\.0009.* \-0*\.0001.* \-0*\.0004.* 0*\.0003.* \-0*\.0000" $log | wc -l`
#CRIT36=`$GREP "H * z * 0*\.0012.* 0*\.0014.* \-0*\.0081.* \-0*\.0005.* 0*\.0001.* 0*\.0033" $log | wc -l`
#CRIT37=`$GREP "H * x * 0*\.0002.* 0*\.0000.* 0*\.0002.* 0*\.0007.* 0*\.0003.* \-0*\.0008" $log | wc -l`
#CRIT38=`$GREP "H * y * \-0*\.0001.* \-0*\.0001.* 0*\.0003.* 0*\.0000.* 0*\.0008.* 0*\.0020" $log | wc -l`
#CRIT39=`$GREP "H * z * \-0*\.0002.* 0*\.0003.* 0*\.0013.* \-0*\.0018.* 0*\.0003.* \-0*\.0083" $log | wc -l`
#CRIT40=`$GREP "H * x * 0*\.0006.* 0*\.0008.* 0*\.0000.* \-0*\.0000.* \-0*\.0001.* \-0*\.0003" $log | wc -l`
#CRIT41=`$GREP "H * y * 0*\.0002.* 0*\.0010.* \-0*\.0003.* \-0*\.0002.* 0*\.0002.* 0*\.0001" $log | wc -l`
#CRIT42=`$GREP "H * z * 0*\.0002.* 0*\.0001.* 0*\.0038.* \-0*\.0001.* \-0*\.0003.* 0*\.0013" $log | wc -l`
#CRIT43=`$GREP "H * x * 0*\.0708" $log | wc -l`
#CRIT44=`$GREP "H * y * \-0*\.0112.* 0*\.4292" $log | wc -l`
#CRIT45=`$GREP "H * z * 0*\.0030.* \-0*\.1247.* 0*\.1189" $log | wc -l`
#CRIT46=`$GREP "H * x * 0*\.0000.* 0*\.0002.* 0*\.0000.* 0*\.3533" $log | wc -l`
#CRIT47=`$GREP "H * y * 0*\.0002.* 0*\.0001.* \-0*\.0003.* 0*\.0688.* 0*\.0993" $log | wc -l`
#CRIT48=`$GREP "H * z * 0*\.0004.* 0*\.0000.* 0*\.0013.* 0*\.0939.* 0*\.0247.* 0*\.1175" $log | wc -l`
#CRIT49=`$GREP "H * x * 0*\.0004.* \-0*\.0001.* \-0*\.0002.* \-0*\.0182.* 0*\.0306.* 0*\.0171" $log | wc -l`
#CRIT50=`$GREP "H * y * \-0*\.0007.* 0*\.0012.* 0*\.0003.* \-0*\.0138.* 0*\.0118.* 0*\.0060" $log | wc -l`
#CRIT51=`$GREP "H * z * \-0*\.0000.* \-0*\.0003.* 0*\.0037.* \-0*\.0118.* 0*\.0132.* 0*\.0064" $log | wc -l`
#CRIT52=`$GREP "H * x * 0*\.0010.* 0*\.0000.* \-0*\.0008.* \-0*\.0046.* \-0*\.0401.* 0*\.0173" $log | wc -l`
#CRIT53=`$GREP "H * y * \-0*\.0001.* 0*\.0007.* \-0*\.0018.* 0*\.0041.* \-0*\.0034.* 0*\.0034" $log | wc -l`
#CRIT54=`$GREP "H * z * 0*\.0005.* \-0*\.0018.* \-0*\.0083.* \-0*\.0039.* \-0*\.0168.* 0*\.0063" $log | wc -l`
#CRIT55=`$GREP "H * x * 0*\.2754" $log | wc -l`
#CRIT56=`$GREP "H * y * \-0*\.2407.* 0*\.3098" $log | wc -l`
#CRIT57=`$GREP "H * z * \-0*\.1192.* 0*\.1268.* 0*\.1204" $log | wc -l`
#CRIT58=`$GREP "H * x * 0*\.0122.* 0*\.0293.* \-0*\.0149.* 0*\.0825" $log | wc -l`
#CRIT59=`$GREP "H * y * \-0*\.0148.* \-0*\.0141.* 0*\.0122.* 0*\.0919.* 0*\.4630" $log | wc -l`
#CRIT60=`$GREP "H * z * \-0*\.0072.* \-0*\.0181.* 0*\.0067.* \-0*\.0324.* \-0*\.1464.* 0*\.1198" $log | wc -l`
#TEST[5]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
#		$CRIT7 \+ $CRIT8 \+ $CRIT9 \+ $CRIT10 \+ $CRIT11 \+ $CRIT12 \+ \
#		$CRIT13 \+ $CRIT14 \+ $CRIT15 \+ $CRIT16 \+ $CRIT17 \+ $CRIT18 \+ \
#		$CRIT19 \+ $CRIT20 \+ $CRIT21 \+ $CRIT22 \+ $CRIT23 \+ $CRIT24 \+ \
#		$CRIT25 \+ $CRIT26 \+ $CRIT27 \+ $CRIT28 \+ $CRIT29 \+ $CRIT30 \+ \
#		$CRIT31 \+ $CRIT32 \+ $CRIT33 \+ $CRIT34 \+ $CRIT35 \+ $CRIT36 \+ \
#		$CRIT37 \+ $CRIT38 \+ $CRIT39 \+ $CRIT40 \+ $CRIT41 \+ $CRIT42 \+ \
#		$CRIT43 \+ $CRIT44 \+ $CRIT45 \+ $CRIT46 \+ $CRIT47 \+ $CRIT48 \+ \
#		$CRIT49 \+ $CRIT50 \+ $CRIT51 \+ $CRIT52 \+ $CRIT53 \+ $CRIT54 \+ \
#		$CRIT55 \+ $CRIT56 \+ $CRIT57 \+ $CRIT58 \+ $CRIT59 \+ $CRIT60`
##CTRL[5]=60
#CTRL[5]=0
#ERROR[5]="INITIAL HESSIAN NOT CORRECT"

# Initial step
CRIT1=`$GREP "C * \-0*\.0144.*  0*\.0042.*   1\.4566" $log | wc -l`
CRIT2=`$GREP "C * \-0*\.0387.*  0*\.0094.* \-1\.4570" $log | wc -l`
CRIT3=`$GREP "H *    1\.5167.*   1\.1740.*   2\.1847" $log | wc -l`
CRIT4=`$GREP "H *  \-1\.7936.*  0*\.7299.*   2\.2059" $log | wc -l`
CRIT5=`$GREP "H *   0*\.2460.* \-1\.9123.*   2\.1716" $log | wc -l`
CRIT6=`$GREP "H *  \-1\.9371.*\-0*\.3164.* \-2\.1623" $log | wc -l`
CRIT7=`$GREP "H *    1\.1456.* \-1\.4948.* \-2\.1881" $log | wc -l`
CRIT8=`$GREP "H *   0*\.6559.*   1\.8057.* \-2\.2128" $log | wc -l`
TEST[6]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
		$CRIT7 \+ $CRIT8`
#CTRL[6]=8
CTRL[6]=0
ERROR[6]="INITIAL STEP NOT CORRECT"

# Second iteration
CRIT1=`$GREP "Energy at this geometry is * \: * \-78\.303(79|80)" $log | wc -l`
CRIT2=`$GREP "Norm of gradient * \: * 0*\.0141" $log | wc -l`
CRIT3=`$GREP "Norm of step     * \: * 0*\.(59|60)" $log | wc -l`
TEST[7]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3`
CTRL[7]=3
ERROR[7]="SECOND ITERATION NOT CORRECT"

# Third iteration
CRIT1=`$GREP "Energy at this geometry is * \: * \-78\.30209" $log | wc -l`
CRIT2=`$GREP "Norm of gradient * \: * 0*\.01919" $log | wc -l`
CRIT3=`$GREP "Norm of step * \: *     0*\.7(199|200)" $log | wc -l`
TEST[8]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3`
CTRL[8]=3
ERROR[8]="THIRD ITERATION NOT CORRECT"

# Final geometry
CRIT1=`$GREP "C * \-0*\.01467.* \-0*\.0003[4-5].*   1\.46247" $log | wc -l`
CRIT2=`$GREP "C * \-0*\.0402..*   0*\.0003[4-5].* \-1\.46285" $log | wc -l`
CRIT3=`$GREP "H *    1\.1356.*    1\.5330.*   2\.1924" $log | wc -l`
CRIT4=`$GREP "H *  \-1\.9081.*   0*\.2233.*   2\.2187" $log | wc -l`
CRIT5=`$GREP "H *   0*\.747..*  \-1\.7579.*   2\.1950" $log | wc -l`
CRIT6=`$GREP "H *  \-1\.9466.*   0*\.2244.* \-2\.1857" $log | wc -l`
CRIT7=`$GREP "H *   0*\.7094.*  \-1\.7569.* \-2\.2094" $log | wc -l`
CRIT8=`$GREP "H *    1\.0971.*    1\.5340.* \-2\.2120" $log | wc -l`
TEST[9]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
		$CRIT7 \+ $CRIT8`
#CTRL[9]=32
CTRL[9]=0
ERROR[9]="FINAL GEOMETRY NOT CORRECT"


# Geometry converged
CRIT1=`$GREP "Geometry converged in * 7 * iterations\!" $log | wc -l`
CRIT2=`$GREP "Energy at final geometry is * \: * \-78\.30160[0-9] a\.u\." $log | wc -l`
CRIT3=`$GREP "Energy change during optimization \: * (\-0|\-)\.00079[0-9] a\.u\." $log | wc -l`
TEST[10]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3`
CTRL[10]=3
ERROR[10]="GEOMETRY OPTIMIZATION NOT CONVERGED CORRECTLY"

PASSED=1
for i in 1 2 3 4 6 7 8 9 10
do
   if [ ${TEST[i]} -ne ${CTRL[i]} ]; then
     echo "${ERROR[i]} : ${TEST[i]} .ne. ${CTRL[i]} ; "
     PASSED=0
   fi
done

if [ $PASSED -eq 1 ]
then
  echo TEST ENDED PROPERLY
  exit 0
else
  echo THERE IS A PROBLEM
  exit 1
fi

%EOF%
#######################################################################
